﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>自定义URL</title>
    <script type="text/javascript" src="../../../Scripts/bootstrap/js/jquery.min.js"></script>
    <script src="../../../Scripts/QueryString.js" type="text/javascript"></script>
    <link href="../../../../DataUser/Style/ccbpm.css" rel="stylesheet"  type="text/css" />

    <!-- 引用通用的js文件. -->
    <script type="text/javascript" src="../../../Scripts/config.js"></script>
    <script type="text/javascript" src="../../../Comm/Gener.js"></script>

    <script type="text/javascript" language="javascript" >
        //页面启动函数.
        $(function () {

            var mapExt = new Entity("BP.Sys.MapExt");
            mapExt.MyPK = "PopSelfUrl_" + GetQueryString("FK_MapData") + "_" + GetQueryString("KeyOfEn");
            var i = mapExt.RetrieveFromDBSources(); //从数据库来查询.
            // alert(mapExt.Tag);
            //alert(mapExt.MyPK);

            if (mapExt.GetPara("SelectType") == "")
                mapExt.SetPara("SelectType", "1");

            //批量为复制.
            GenerFullAllCtrlsVal(mapExt);

            //基本属性.
            // $("#TB_Title").val(mapExt.GetPara("Title"));
            //p").val(mapExt.GetPara("SearchTip"));
            // $("#TB_RootTreeNo").val(mapExt.GetPara("RootNo")); //树的根节点编号.

            //设置按钮是否可以用?
            if (i == 0)
                $("#Btn_Delete").attr("disabled", true);
            else
                $("#Btn_Delete").removeAttr("disabled");
        });

        function Delete() {

            if (confirm('您确定要删除吗？') == false)
                return;

            var mapExt = new Entity("BP.Sys.MapExt");
            mapExt.MyPK = "PopSelfUrl_" + GetQueryString("FK_MapData") + "_" + GetQueryString("KeyOfEn");
            mapExt.RetrieveFromDBSources(); //从数据库来查询.
            mapExt.Delete();
            window.location.href = window.location.href;
        }

        function Save() {

            var mapExt = new Entity("BP.Sys.MapExt");
            mapExt.MyPK = "PopSelfUrl_" + GetQueryString("FK_MapData") + "_" + GetQueryString("KeyOfEn");
            mapExt.RetrieveFromDBSources(); //从数据库来查询.

            mapExt.CopyURL();  //从url里面copy数据.
            mapExt.CopyForm(); //从from里面copy数据.
             

            mapExt.ExtType = "PopSelfUrl";
            mapExt.AttrOfOper = GetQueryString("KeyOfEn");


            var err = "";

            if (mapExt.GetPara("Title") == "")
                err += '\t\n必填字段[标题]不能为空';

            if (mapExt.Tag1 == "")
                err += '\t\n必填字段[搜索数据源]不能为空';

            if (mapExt.Tag2 == "")
                err += '\t\n必填字段[左侧树列表数据源]不能为空';

            if (mapExt.Tag == "")
                err += '\t\n必填字段[数据列名与中文意思对照]不能为空';

            if (mapExt.DBType == "")
                err += '\t\n必填字段[数据源类型]不能为空';

            var val = mapExt.Save();
            // alert(val);
            window.location.href = window.location.href;
        }
    </script>
</head>
<body  >

<form id="cc">

<table id="Table1" style="width:99%;">
<caption>自定义URL</caption>

<tr>
<th colspan="2" >基本信息</th>
</tr>

<tr>
<td> <a href="javascript:alert('显示在窗口的文字，比如:搜索单据.')"> 标题</a></td>
<td><input type="text" id="TBPara_Title" name="TBPara_Title" style="width:99%;" /> 
</td>
</tr>

<tr>
<td>弹窗属性</td>
<td >高度:<input type="text"  id="TB_H" name="TB_H" style="width:80px; text-align:right"  /> 宽度:<input type="text"  id="TB_W" name="TB_W" style="width:80px; text-align:right"  /> </td>
</tr>

<tr>
<th colspan="2">
<a href="javascript:ShowHidden('divTag')">自定义的URL</a>
 <div id="divTag" style="color:Gray; display:none">
 <ul>
 <li>您选择了使用外部的URL. </li>
 <li>使用外部的URL，我们提供了一个demo,您需要按照自己的格式来编写该url.</li>
 <li>该demo的位置 /SDKFlowDemo/PopSelectVal.htm </li>
 </ul>
 </div>

</th>
</tr>

<tr>
<td colspan="2">
<input id="TB_Tag" name="TB_Tag" style="width:100%;" />
</td>
</tr>

<tr>
<td colspan="2"><input type="button" value="保存"  id="Btn_Save" name="Btn_Save" onclick="return Save()" />
<input type="button" value="删除"  id="Btn_Delete" name="Btn_Delete" onclick="return Delete()" />
</td>
</tr>

</table>

 

</form>

</body>
</html>
